<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--    引入本地js文件使用-->
    <script type="text/javascript" src="../js/jquery-3.4.1.min.js"></script>
    <title>表格隔行变色</title>
<script type="text/javascript">
   $(function(){
     //选择所有偶数行
      $("tr:even").css("background-color", "red");
      //选择所有奇数行
      $("tr:odd").css("background-color", "green");
   });
</script>
</head>
<body>

    <table width="800" border="1">
       <tr>
         <td>id</td>
         <td>姓名</td>
         <td>年龄</td>
         <td>性别</td>
         <td>操作</td>
       </tr>
      <tr>
          <td>1</td>
          <td>青龙</td>
          <td>18</td>
          <td>男</td>
          <td>
            <input type="button" value="修改"> &nbsp;&nbsp;
            <input type="button" value="删除">
          </td>
      </tr>
      <tr>
        <td>2</td>
        <td>梼杌</td>
        <td>18</td>
        <td>男</td>
        <td>
          <input type="button" value="修改"> &nbsp;&nbsp;
          <input type="button" value="删除">
        </td>
      </tr>
      <tr>
        <td>3</td>
        <td>白虎</td>
        <td>18</td>
        <td>女</td>
        <td>
          <input type="button" value="修改"> &nbsp;&nbsp;
          <input type="button" value="删除">
        </td>
      </tr>
      <tr>
        <td>4</td>
        <td>朱雀</td>
        <td>18</td>
        <td>女</td>
        <td>
          <input type="button" value="修改"> &nbsp;&nbsp;
          <input type="button" value="删除">
        </td>
      </tr>
      <tr>
        <td>5</td>
        <td>玄武</td>
        <td>18</td>
        <td>男</td>
        <td>
          <input type="button" value="修改"> &nbsp;&nbsp;
          <input type="button" value="删除">
        </td>
      </tr>
      <tr>
        <td>6</td>
        <td>饕鬄</td>
        <td>18</td>
        <td>男</td>
        <td>
          <input type="button" value="修改"> &nbsp;&nbsp;
          <input type="button" value="删除">
        </td>
      </tr>
    </table>
</body>
</html>